package com.bltec.emergency.service.commonService.impl;

import com.bltec.emergency.mapper.UserMapper;
import com.bltec.emergency.model.User;
import com.bltec.emergency.service.commonService.LoginService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class LoginServiceImpl implements LoginService {

    @Resource
    UserMapper userMapper;

    //判断用户是否存在
    public boolean hasUser(String userName) {
        if (userName != null) {
            User user = getByUserName(userName);
            return user != null;
        }
        return false;
    }

    //通过UserName获得User
    public User getByUserName(String userName) {
        return userMapper.getUserByUsername(userName);
    }
}
